package at.fhooe.mc.master.clc.server.domain.objectify;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import at.fhooe.mc.master.clc.server.domain.AbstractTestable;
import at.fhooe.mc.master.clc.server.domain.IBigEntity;
import at.fhooe.mc.master.clc.server.domain.IEmbeddedEntity;

import com.googlecode.objectify.annotation.EmbedMap;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.annotation.Unindex;

@Entity
public class BigEntityObjectify extends AbstractTestable implements IBigEntity
{
	@Id private Long id;
	
	// each 100 entries
	@Unindex
	private List<String> stringList1;
	
	@EmbedMap
	@Unindex
	private Map<String, String> stringMap1;
	
	private EmbeddedObjectifyEntity embeddedEntity;
	// 10 entries
//	private List<EmbeddedObjectifyEntity> embeddedEntityList;
	
	public BigEntityObjectify() {}
	
	public BigEntityObjectify(boolean generate)
	{
		if (generate)
		{
			stringMap1 = new HashMap<String, String>();
			stringList1 = new ArrayList<String>();
			
			for (int i = 0; i < 100; i++)
			{
				stringMap1.put("1_key" + i, "1_value" + i);
				stringList1.add("string_entry" + i);
			}
			
			embeddedEntity = new EmbeddedObjectifyEntity(true);
//			embeddedEntityList = new ArrayList<EmbeddedObjectifyEntity>();
//			for (int i = 0; i < 10; i++)
//			{
//				embeddedEntityList.add(new EmbeddedObjectifyEntity(true));
//			}
		}
	}
	
	@Override
	public Long getId()
	{
		return this.id;
	}

	@Override
	public Map<String, String> getStringMap1()
	{
		return stringMap1;
	}

	@Override
	public List<String> getStringList1()
	{
		return stringList1;
	}

	@Override
	public IEmbeddedEntity getEmbeddedEntity()
	{
		return embeddedEntity;
	}

	@Override
	public List<? extends IEmbeddedEntity> getEmbeddedEntityList()
	{
//		return embeddedEntityList;
		return null;
	}
	
}
